import csv

# 学生信息数据
students_data = [
    ["学号", "姓名", "性别", "年龄", "专业", "班级"],
    ["20210001", "张三", "男", 20, "计算机科学", "1班"],
    ["20210002", "李四", "女", 21, "电子信息工程", "2班"],
    ["20210003", "王五", "男", 19, "机械工程", "3班"],
    ["20210004", "赵六", "女", 20, "土木工程", "1班"],
    ["20210005", "孙七", "男", 22, "自动化", "2班"],
    ["20210006", "周八", "女", 21, "电气工程", "3班"],
    ["20210007", "吴九", "男", 20, "材料科学", "1班"],
    ["20210008", "郑十", "女", 19, "化学工程", "2班"],
    ["20210009", "冯十一", "男", 21, "生物医学工程", "3班"],
    ["20210010", "陈十二", "女", 20, "环境科学", "1班"],
    ["20210011", "杨十三", "男", 22, "数学", "2班"],
    ["20210012", "黄十四", "女", 21, "物理", "3班"],
    ["20210013", "张十五", "男", 20, "哲学", "1班"],
    ["20210014", "李十六", "女", 19, "历史", "2班"],
    ["20210015", "王十七", "男", 21, "文学", "3班"],
    ["20210016", "赵十八", "女", 20, "艺术", "1班"],
    ["20210017", "孙十九", "男", 22, "法学", "2班"],
    ["20210018", "周二十", "女", 21, "经济学", "3班"],
    ["20210019", "吴二十一", "男", 20, "管理学", "1班"],
    ["20210020", "郑二十二", "女", 19, "心理学", "2班"]
]

# 写入学生信息到文件
with open('students.csv', 'w', newline='', encoding='utf-8-sig') as file:
    writer = csv.writer(file)
    writer.writerows(students_data)

print("学生信息数据已生成并保存到 students.csv 文件中。")
